#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "ValueSpecification.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Observation;
class ValueSpecification;

/// <summary>
/// TimeExpression
/// A TimeExpression is a ValueSpecification that represents a time value.
/// </summary>
class UMLMODEL_EXPORT TimeExpression : public ValueSpecification {

public: // Constructors and destructors
    explicit TimeExpression(const QString& umlType="uml::TimeExpression");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// expr getter
    /// A ValueSpecification that evaluates to the value of the TimeExpression.
    /// </summary>
    shared_ptr<ValueSpecification> expr() const;

    /// <summary>
    /// expr setter
    /// A ValueSpecification that evaluates to the value of the TimeExpression.
    /// </summary>
    void setExpr(shared_ptr<ValueSpecification> value);

    /// <summary>
    /// observations getter
    /// Refers to the Observations that are involved in the computation of the
    /// TimeExpression value.
    /// </summary>
    vector<shared_ptr<Observation>>& observations();

private: // Fields
    /// <summary>
    /// expr
    /// A ValueSpecification that evaluates to the value of the TimeExpression.
    /// </summary>
    shared_ptr<ValueSpecification> expr_;

    /// <summary>
    /// observations
    /// Refers to the Observations that are involved in the computation of the
    /// TimeExpression value.
    /// </summary>
    vector<shared_ptr<Observation>> observations_;

};

} // namespace uml
